﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QunProject.Cache
{
    /// <summary>
    /// 缓存接口
    /// </summary>
    public interface ICache
    {
        /// <summary>
        /// 设置一个缓存
        /// </summary>
        /// <param name="key">键</param>
        /// <param name="value">值</param>
        /// <returns></returns>
        bool Set(string key, object value);
        /// <summary>
        /// 设置一个缓存
        /// </summary>
        /// <param name="key">键</param>
        /// <param name="value">值</param>
        /// <param name="seconds">过期时间（单位：分钟）</param>
        /// <returns></returns>
        bool Set(string key, object value, int seconds);
        /// <summary>
        /// 获取一个缓存
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        object Get(string key);
        /// <summary>
        /// 清除一个缓存
        /// </summary>
        /// <param name="key">键</param>
        /// <returns></returns>
        void Clear(string key);
        /// <summary>
        /// 清除全部缓存
        /// </summary>
        /// <returns></returns>
        void Clear();
    }
}
